<script language="JavaScript">
	$(function(){
		$("#receiver").change(function(){
			$("#message_username").val($(this).val());			
		});
	});
</script>
<div id="message">
	<% form_for :message do |f|%>
		<%= text_field_for f, :username, @message,{:text=>"收件人",:required=>true, :value => @username }%>
		<%= select_tag "receiver", "<option>请选择</option>" + options_from_collection_for_select(@login_user.friends, "username", "name")%>
		<%= text_field_for f, :title,    @message,{:text=>"主题",:required=>true}%>
		<%= text_area_for f,  :content,  @message,{:text=>"内容",:required=>true}%>
		<%= submit_tag "发送", :class => "btn" %>
	<% end %>
</div>